# 导包
import unittest
from tools.HTMLTestRunner import HTMLTestRunner
# 第二种方法
from scripts.test01_login import TestLoginAPI
from scripts.test02_employee import TestEmployeeAPI
# 绝对路径
import app

# 封装测试套件
# suite = unittest.TestLoader().discover('./scripts','test*.py')

# 第二种方法
suite = unittest.TestSuite()
# 登陆接口
suite.addTest(unittest.makeSuite(TestLoginAPI))

# 员工管理接口
suite.addTest(TestLoginAPI('test001'))
suite.addTest(unittest.makeSuite(TestEmployeeAPI))

# 打开文件流
with open(app.BASE_DIR + '/report/report.html','wb') as f:
    # 执行测试套件
    runner =HTMLTestRunner(f,title='IHRM登陆测试报告')
    runner.run(suite)

# 打开文件流
# file = open('./report/report01.html','wb')
# 执行测试套件
# runner = HTMLTestRunner(file,title='登陆测试报告')
# runner.run(suite)
# file.close()